<!-- 评论区 panel start-->
#articleComments(pageNumber=pn,pageSize=10,articleId=article.id)
<div class="mt-5 lyear-comment-title">
    <h5><span>评论 (#(commentPage.totalRow))</span></h5>
</div>
<ul class="media-list list-unstyled lyear-comment" id="commentsList">
    #for(comment : commentPage.getList())
    <li id="comment-#(comment.id)">
        <div class="media">
            <img class="d-flex mr-3 rounded-circle" src="/upload/avatar/#(comment.avatar)" alt="#(comment.nickName)">
            <div class="media-body">
                <a href="#!" class="text-custom reply-btn" data-id="1"><i class="mdi mdi-reply"></i>&nbsp; 回复</a>
                <h4 class="media-heading"><a href="#!">#(comment.nickName)</a></h4>
                <p class="text-muted post-date">#date(comment.created, "yyyy-MM-dd HH:mm")</p>
                <p>#(comment.content)</p>
            </div>
        </div>
    </li>
    #end
</ul>
<!-- 分页 -->
<div class="row">
    <div class="col-lg-12">
        #include("_paginate.html")
        #@FrontPaginate(commentPage,"/article/"+article.slug+"?pn=")
    </div>
</div>
<!-- 分页 end -->
#end
<div id="respond" class="comment-respond">
    <div class="mt-2">
        <h5><span>说点什么吧...</span> <small class="cancel-comment-reply" onclick="cancelReply()">(取消回复)</small></h5>
    </div>
    <form action="/article/comments/save" method="post" class="mt-4 lyear-comment-form" id="comment-Form" onsubmit="return false;">
        <div class="row">
            <div class="col-sm-12">
                <div class="form-group">
                    <input type="hidden" name="comment.articleId" value="#(article.id)"/>
                    <textarea id="comment" class="form-control" rows="5" placeholder="想说的内容" name="comment.content" required=""></textarea>
                </div>
            </div>
        </div>
        <div class="row">
            <div class="col-sm-12">
                <div class="form-group">
                    <button name="submit" type="button" id="submitBtn" class="btn btn-primary">发表评论</button>
                    <input type='hidden' name='comment_arc_id' value='1' id='comment_arc_id' />
                    <input type='hidden' name='comment_parent' id='comment_parent' value='0' />
                </div>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="#(tmplPath)/js/jquery.min.js"></script>
<script src="/assets/lib/jquery_form/jquery.form.js"></script>
<script src="/assets/lib/layer/layer.js"></script>
<script type="text/javascript" src="/assets/js/jfinal-kit.js"></script>
<script>
    	function submitComment() {
		var $form = $('#comment-Form');
		var loading = kit.loading('正在处理, 请稍候 .....');
		kit.post($form.attr('action'), $form.serialize(), function(ret) {
			loading.close();		// 关闭 loading 层

			if (ret.state == 'ok') {
				layer.closeAll();	// 提交成功关闭 open 弹出层
                $("#commentsList").append(ret.commentItem);
			}
			kit.msg(ret, {time:3200, closeBtn:2});
		});
	}
	$("#submitBtn").on("click",submitComment);
</script>